package com.fivetalks.client;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.fivetalks.object.Member;

public class LoveCustomAdapter extends ArrayAdapter<Member> {
	
	private Context mContext;
	private int mResource;
	private ArrayList<Member> mList;
	private LayoutInflater mInflater;
	
	
	public LoveCustomAdapter(Context context, int layoutResource,
			ArrayList<Member> objects) {
		super(context, layoutResource, objects);
		this.mContext = context;
		this.mResource = layoutResource;
		this.mList = objects;
		this.mInflater = (LayoutInflater) mContext
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		Member member = mList.get(position);

		if (convertView == null) {
			convertView = mInflater.inflate(mResource, null);
		}

		if (member != null) {

			TextView tvEmail = (TextView) convertView
					.findViewById(R.id.tvEmail);
			TextView tvNickname = (TextView) convertView
					.findViewById(R.id.tvNickname);
			
			tvEmail.setTextColor(Color.WHITE);
			tvEmail.setText(member.getEmail());
			tvNickname.setTextColor(Color.WHITE);
			tvNickname.setText(member.getNickname());
		}

		convertView.setTag(position);

		return convertView;
	}

}
